package com.xprime.mobileFramework.function;

import android.app.TimePickerDialog;
import android.content.Context;
import android.widget.TimePicker;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;
import com.adobe.fre.FREWrongThreadException;

public class TimePickerDialogFREFunction implements FREFunction {
	
	
	@Override
	public FREObject call(FREContext pContext, FREObject[] arg1) {
		Context context = pContext.getActivity();	
		final FREContext freContext = pContext;
	
		TimePickerDialog dialog =new TimePickerDialog(context, new TimePickerDialog.OnTimeSetListener() {
				
				@Override
				public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
					freContext.dispatchStatusEventAsync("timePickerDialog", hourOfDay+","+minute);
				}
			}, 10, 10, true);
			dialog.show();

		try {
			return FREObject.newObject("TimePickerDialogFREFunction success!!!!!!!");
		} catch (FREWrongThreadException e) {
			e.printStackTrace();
		}
		return null;
	}

}
